package com.mayikt.weixin.feign.fallback;

import cn.hutool.core.lang.Console;
import com.mayikt.base.BaseApiService;
import com.mayikt.base.BaseResponse;
import com.mayikt.base.enums.ApiResponseEnum;
import com.mayikt.exception.BizException;
import com.mayikt.member.input.dto.UserLoginInpDTO;
import com.mayikt.member.output.dto.UserOutDTO;
import com.mayikt.weixin.feign.MemberServiceFeign;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Description:
 * @Auther: zhangxun
 * @Date: 2020/6/11 19:22
 */
@Component
public class MemberServiceFallback extends BaseApiService<UserOutDTO> implements MemberServiceFeign {
    @Override
    public BaseResponse<UserOutDTO> existMobile(String mobile) {
        Console.log("The server is busy processing requests. Please take a tea break(method:existMobile)");
        UserOutDTO userOutDTO = new UserOutDTO();
        userOutDTO.setUserName("zhangxun");
        return setResultSuccess(userOutDTO);
    }

    @Override
    public BaseResponse<UserOutDTO> getInfo(String token) {
        Console.log("The server is busy processing requests. Please take a tea break(method:getInfo)");
        throw new BizException(ApiResponseEnum.INTERNAL_ERROR,"The server is busy processing requests. Please take a tea break(method:getInfo)");
    }

    @Override
    public BaseResponse<UserOutDTO> ssoLogin(UserLoginInpDTO userLoginInpDTO) {
        Console.log("The server is busy processing requests. Please take a tea break(method:ssoLogin)");
        throw new BizException(ApiResponseEnum.INTERNAL_ERROR,"The server is busy processing requests. Please take a tea break(method:ssoLogin)");
    }

    @PostConstruct
    public void init(){
        Console.log("====> 初始化测试！");
    }
}